package com.hqyj.controller;

import com.hqyj.pojo.Yan_addcustomerpojo;
import com.hqyj.service.service.YanAddCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/workspace")
public class workSpaceController {
    // 处理客户总览
    @Autowired(required = false)
    YanAddCustomerService yanAddCustomerService;

    @ResponseBody
    @RequestMapping("/customerList")
    public List<Yan_addcustomerpojo> getcustomerList(){
        List<Yan_addcustomerpojo> list = new ArrayList<>();
        list = yanAddCustomerService.getAllList();
        return list;
    }

    // 处理用户查询
    @ResponseBody
    @RequestMapping("/search")
    public List<Yan_addcustomerpojo> search(String userName){
        System.out.println(userName);

        List<Yan_addcustomerpojo> list = new ArrayList<>();
        list = yanAddCustomerService.search(userName);
        return list;
    }
}
